package main.java.com.extract;

import java.util.Enumeration;
/**
 * @description:    java类作用描述
 * http://t.zoukankan.com/kanite-p-7695945.html
 * @author:         cong zhi
 * @createDate:     2022/6/16 17:50
 * @updateUser:     cong zhi
 * @updateDate:     2022/6/16 17:50
 * @updateRemark:   修改内容
 * @version:        v1.0
 */
public abstract class Statement {


    public String statement(Customer customer) {
        Enumeration<Rental> rentals = customer.getRentals().elements();
        String result = headerString(customer);

        while (rentals.hasMoreElements()) {
            Rental each = (Rental) rentals.nextElement();
            result += eachRentalString(each);
        }
        result += footerString(customer);

        return result;
    }

    /**
     * @return
     */
    public abstract String headerString(Customer customer);

    abstract String eachRentalString(Rental rental);

    abstract String footerString(Customer customer);


}
